import sqlalchemy
from sqlalchemy.orm import Mapped, mapped_column, relationship
from settings.publicvar import Base
from sqlalchemy import String, ForeignKey

from views.schoolInfo.model.SchoolInfo import SchoolInfo


class InitSetting(Base):
    __tablename__ = 'initsetting'

    id:Mapped[int] = mapped_column(primary_key=True)
    name:Mapped[str] = mapped_column(sqlalchemy.String(20))
    school_id:Mapped[str] = mapped_column(ForeignKey('schoolinfo.id'))

    school:Mapped[SchoolInfo] = relationship(lazy=False, backref='initsettings')

    def __repr__(self):
        return f'name:{self.name}'
